package C;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.Scanner;
import java.util.StringJoiner;

public class C19 {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int[] nums = Arrays.stream(sc.nextLine().split(" ")).mapToInt(Integer::parseInt).toArray();
        System.out.println(getResult(nums));

    }

    public static String getResult(int[] nums) {
        StringJoiner sj = new StringJoiner(" ");
        ArrayList<Integer> stack = new ArrayList<>();
        for (int i=0;i<nums.length;i++) {
            push(nums[i],stack);
        }
        while(stack.size()>0) {
            sj.add(stack.remove(stack.size()-1).toString());
        }
        return sj.toString();
    }

    public static void push(int num,ArrayList<Integer> stack) {
        int sum = num;
        for (int i=stack.size()-1;i>=0;i--) {
            sum -= stack.get(i);
            if (sum == 0) {
                stack.subList(i,stack.size()).clear();
                num = num*2;
                push(num,stack);
                return;
            } else if (sum<0) {
                break;
            }
        }
        stack.add(num);
    }
}
